﻿using System;
using System.Collections.Generic;

using System.Text;

namespace System.Qizx.Xdm
{
    public enum XdmNodeChangedAction
    {
        Insert,
        Remove,
        Change
    }

    public delegate void XdmNodeChangedEventHandler(object sender, XdmNodeChangedEventArgs e);

    public class XdmNodeChangedEventArgs : EventArgs
    {
        // Fields
        private XdmNodeChangedAction action;
        private XdmNode newParent;
        private string newValue;
        private XdmNode node;
        private XdmNode oldParent;
        private string oldValue;

        // Methods
        public XdmNodeChangedEventArgs(XdmNode node, XdmNode oldParent, XdmNode newParent, string oldValue, string newValue, XdmNodeChangedAction action)
        {
            this.node = node;
            this.oldParent = oldParent;
            this.newParent = newParent;
            this.action = action;
            this.oldValue = oldValue;
            this.newValue = newValue;
        }

        // Properties
        public XdmNodeChangedAction Action
        {
            get
            {
                return this.action;
            }
        }

        public XdmNode NewParent
        {
            get
            {
                return this.newParent;
            }
        }

        public string NewValue
        {
            get
            {
                return this.newValue;
            }
        }

        public XdmNode Node
        {
            get
            {
                return this.node;
            }
        }

        public XdmNode OldParent
        {
            get
            {
                return this.oldParent;
            }
        }

        public string OldValue
        {
            get
            {
                return this.oldValue;
            }
        }
    }
}
